[PATCH] readelf: Allocate job_data one-by-one as needed
authorAaron Merey <amerey@redhat.com>
Tue, 28 Oct 2025 02:00:12 +0000 (22:00 -0400)
committerMatthias Klose <doko@debian.org>
Tue, 17 Mar 2026 14:25:35 +0000 (15:25 +0100)
commit1a4d1806118733be619034c599aac53d0319c2b7
tree085f7e750065d5173cf579b4df0ed05d3f05a07b
parent8752ee8e05188bcab7239ac6c52f3af5c75247c1
[PATCH] readelf: Allocate job_data one-by-one as needed

Currently, job_data is stored in an array whose size is equal to the
number of debug sections (.debug_*, .eh_frame, .gdb_index, etc.).

This size may be too small if a binary contains multiple debug sections
with the same name.  For example an ET_REL binary compiled with -ggdb3
can contain multiple .debug_macro sections.

Fix this by allocating job_data on the fly when preparing to read a
debug section.  This supports an arbitrary number of debug sections
while also avoiding unnecessary memory allocation.

https://sourceware.org/bugzilla/show_bug.cgi?id=33580

Signed-off-by: Aaron Merey <amerey@redhat.com>
Gbp-Pq: Name elfutils-0.194-alloc-jobs.patch
src/readelf.c